/**
 *    Copyright 2009 Seth Albnaese
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.aquiferserver.client.flex.logging 
{
	
	/**
	 * ...
	 * @author Seth Albanese
	 * @version $Id: Log.as 24 2009-05-11 13:27:21Z salbanese0080@gmail.com $
	 */
	public class Log 
	{
		
		private var clazz:String;
		private var config:Object;
		
		public function Log( clazz:String, config:Object ) 
		{
			this.clazz = clazz;
			this.config = config;		
		}
		
		public function info( message:String ) : void
		{
			if ( config.info )
			{
				writeLogMessage( "info", message );
			}
		}
		
		public function warn( message:String ) : void
		{
			if ( config.warn )
			{
				writeLogMessage( "warn", message );
			}
		}
		
		public function debug( message:String ) : void
		{
			if ( config.debug )
			{
				writeLogMessage( "debug", message );
			}
		}
		
		public function fatal( message:String ) : void
		{
			if ( config.fatal )
			{
				writeLogMessage( "fatal", message );
			}
		}
		
		private function writeLogMessage( lvl:String, message:String ) : void 
		{
			trace( "[ " + lvl + " ] " + clazz + " : " + message );
		}
	}
	
}